﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WanFang.Test
{
    public class PersonService: IPersonService,IApplicationService
    {
        private readonly IRepository<Person> _repository;
        public PersonService(IRepository<Person> repository)
        {
            _repository = repository;
        }

        public Person Get(int id)
        {
            return _repository.Get(id);
        }
        public IList<Person> GetList()
        {
           return _repository.GetAll().OrderBy(t => t.Name).ToList();
        }
        public void Add(Person entity)
        {
            _repository.Insert(entity);
        }
        public void Update(Person entity)
        {
            _repository.Update(entity);
        }
        public void Delete(Person entity)
        {
            _repository.Delete(entity);
        }
        public void Delete(int id)
        {
            _repository.Delete(id);
        }
    }
}
